//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System.Web.UI.WebControls;

using CommunityServer.Components;
using CommunityServer.Discussions.Components;

namespace CommunityServer.Discussions.Controls {

    public class ThreadStatusImage: Image {
        
        #region Render
        protected override void Render (System.Web.UI.HtmlTextWriter writer) {
            // Is thread status enabled?            
            if (!ForumConfiguration.Instance().EnableThreadStatus)
                return;

            switch (ThreadStatus) {

                case ThreadStatus.NotAnswered:
                    ImageUrl = Globals.GetSkinPath() + "/images/status_NotAnswered.gif";
                    AlternateText = ResourceManager.GetString("PostView_ThreadStatusLabel")+ ResourceManager.GetString("Status_NotAnswered");
                    break;

                case ThreadStatus.Answered:
                    ImageUrl = Globals.GetSkinPath() + "/images/status_Answered.gif";
                    AlternateText = ResourceManager.GetString("PostView_ThreadStatusLabel") + ResourceManager.GetString("Status_Answered");
                    break;

                case ThreadStatus.NotSet:
                    ImageUrl = Globals.GetSkinPath() + "/images/status_NotSet.gif";
                    AlternateText = ResourceManager.GetString("PostView_ThreadStatusLabel") + ResourceManager.GetString("Status_NotSet");
                    break;

                default:
                    return;
            }

            base.Render (writer);
        }
        #endregion

        #region Properties

        ThreadStatus threadStatus = ThreadStatus.NotSet;
        public ThreadStatus ThreadStatus {
            get {
                return threadStatus;
            }
            set {
                threadStatus = value;
            }
        }

        #endregion
    }
}
